Declarations of arrays (Cont.)
Pascal
C/C++
w
var
w
a: array[0..9] of integer;
w
b: array[0..4, 0..9] of
integer;
w
int a[10];
w
float b[5][10];
w
w
Arrays in C always have
subscripts ranging from 0
to declared size – 1.
NO DIRECT EQUIVALENT IN C. WORK AROUND THIS BY DECLARING:
int c[10];
AND LETTING SUBSCRIPTS RANGE FROM 0..9
C does not distinguish between packed and unpacked arrays.